#ifndef __RUN_TO_POSITION_BEHAVIOR__
#define __RUN_TO_POSITION_BEHAVIOR__

#include "../ModuleInterface.h"
#include "../../World/Myself.h"
#include "TurnNeckToBehaviour.h"
#include "TurnToBehaviour.h"
#include "OffsideLineBreachBehaviour.h"

#define POS_TOL 1.0f

/* 
 * Bezi na poziciu zadanu na vstupe istou rychlostou
 */
class RunToPositionBehaviour : public ModuleInterface
{
	USE_MODULE(TurnNeckToBehaviour)
	USE_MODULE(TurnToBehaviour)
	USE_MODULE(OffsideLineBreachBehaviour)

public:
	virtual void Behave(Point position, int speedMode);
	virtual void Behave(const Point& target, bool hurry, bool forLife = false, float positionTolerance = POS_TOL, int angleTolerance = 10);
	virtual void BehaveBackwards(const Point& target, bool hurry, bool forLife = false, float positionTolerance = POS_TOL, int angleTolerance = 10);
	float RecommDashPower(bool fast, bool reallyFast = false);
	float RecommendDashToMaxSpeed();
	float CompMoment(float moment);
	Myself AfterDash(const Myself& me,float dashPower);
	void ExitOffside();
	bool GotoPositionToPass();

	Vector PredictNextVelocity(float dashPower);
	Vector PredictNextVelocity(float dashPower,const Myself &me);
	int PredictSteps(float distance, float power, float actualSpeed = 0);

private:
	float CalcRealSpeedMax();
	bool IsOffsidePosition(Point target);
};

#endif
